Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests and set-image option to kubectl debug #96058

Merged
merged 2 commits into from
Nov 4, 2020

Conversation

verb
Copy link
Contributor

@verb verb commented Oct 30, 2020

What type of PR is this?

/kind feature
/sig cli
/priority important-soon

What this PR does / why we need it: Implements feature and tests for kubernetes/enhancements#1441

Which issue(s) this PR fixes:

Fixes #94855

Special notes for your reviewer: Slight change in KEP for how image mutations are specified. See examples in debug.go.

Does this PR introduce a user-facing change?:

`kubectl debug` gains support for changing container images when copying a pod for debugging, similar to how `kubectl set image` works. See `kubectl help debug` for more information.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/1441-kubectl-debug

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 30, 2020
@verb verb force-pushed the 1.20-cli-debug-image-mutations branch from ffd72be to 7174800 Compare November 2, 2020 11:25
kubectl alpha debug mypod --copy-to=my-debugger --set-image=*=busybox

# Create a copy of mypod adding a debug container and changing container images
kubectl alpha debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soltysh When implementing image mutation I realized it might be more intuitive to have a separate flag, using --image for adding a new debug container and --set-image for changing the images of existing containers. With this syntax it's possible to perform both operations in a single command, but mainly I just think the syntax is clearer.

Could you have a look at these examples and let me know what you think? For reference, we previously discussed overloading the --image flag for both uses

@verb verb force-pushed the 1.20-cli-debug-image-mutations branch from 7174800 to 805fa4c Compare November 3, 2020 06:05
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 3, 2020
@verb verb force-pushed the 1.20-cli-debug-image-mutations branch from 805fa4c to 2a67420 Compare November 3, 2020 09:32
@verb verb changed the title WIP: Add tests and set-image option to kubectl debug Add tests and set-image option to kubectl debug Nov 3, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 3, 2020
@verb
Copy link
Contributor Author

verb commented Nov 3, 2020

/assign @soltysh

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
please fix the error messages, since there's this many 😉

staging/src/k8s.io/kubectl/pkg/cmd/debug/debug.go Outdated Show resolved Hide resolved
staging/src/k8s.io/kubectl/pkg/cmd/debug/debug.go Outdated Show resolved Hide resolved
staging/src/k8s.io/kubectl/pkg/cmd/debug/debug.go Outdated Show resolved Hide resolved
staging/src/k8s.io/kubectl/pkg/cmd/debug/debug.go Outdated Show resolved Hide resolved
@verb verb force-pushed the 1.20-cli-debug-image-mutations branch from 2a67420 to ee9f11b Compare November 3, 2020 19:59
@verb
Copy link
Contributor Author

verb commented Nov 3, 2020

@soltysh thanks! Ok, I think I've fixed all the error messages. I'll add pwittrock for the visible_to change.

/assign @pwittrock

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 3, 2020
@soltysh
Copy link
Contributor

soltysh commented Nov 3, 2020

Manually adding approve since this is kubectl targeted change.

@soltysh
Copy link
Contributor

soltysh commented Nov 3, 2020

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 3, 2020
@soltysh soltysh added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by: soltysh, verb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

1 similar comment
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 1ba2709 into kubernetes:master Nov 4, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.20 milestone Nov 4, 2020
@verb verb deleted the 1.20-cli-debug-image-mutations branch November 4, 2020 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow specifying multiple image name mutations in kubectl debug
5 participants